package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsAccountTraceMapper;
import com.qf.pojo.DtsAccountTrace;
import com.qf.service.DtsAccountTraceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @version 1.0
 * @auther Administrator
 * @date 2023/2/24 10:38
 */
@Service
public class DtsAccountTraceServiceImpl implements DtsAccountTraceService {

    @Autowired
    private DtsAccountTraceMapper dtsAccountTraceMapper;

    /**
     * 佣金查询
     * @param page
     * @param limit
     * @param sort
     * @param order
     * @param traceSn
     * @return
     */
    @Override
    public IPage<DtsAccountTrace> findListByQuery(Integer status,String mobile,String username,Integer page, Integer limit, String sort, String order, String traceSn) {
        return dtsAccountTraceMapper.selectPage(new Page(page,limit),
                new QueryWrapper<DtsAccountTrace>()
                        .like(!StringUtils.isEmpty(traceSn),"trace_sn",traceSn)
                        .eq(!StringUtils.isEmpty(mobile),"mobile",mobile)
                        .eq(!StringUtils.isEmpty(status),"status",status)
                        .orderBy(!StringUtils.isEmpty(sort),"ASC".equalsIgnoreCase(order),sort));
    }
}
